import config from "@/config";
import {ModifyPasswordBodyModel, ResetPasswordBodyModel} from "@/pages/sys/account/data";
import {ApiResult} from "@/utils/data";
import {post} from "@/utils/request";
import {getCurrentUserId} from "@/utils/utils";

/** 获取系统账户接口基地址 */
const getUrl = (url: string) => config.apiBaseUrl + '/sys/account' + url;

/** 系统用户接口服务 */
const service = {
  /** 修改用户密码 */
  async modifyPassword(data: ModifyPasswordBodyModel): Promise<ApiResult> {
    const currentUserId = getCurrentUserId();
    data.id=currentUserId;
    return post(getUrl('/modifyPassword'), data);
  },

  /** 重置用户密码 */
  async revisePassword(data: ResetPasswordBodyModel): Promise<ApiResult> {
    return post(getUrl('/revisePassword'), data);
  },
}
export default service;
